package com.yundasys.lab17.lab17springbootdemo.controller;

import com.yundasys.lab17.lab17springbootdemo.service.ExampleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

/**
 * @Title: ExampleController
 * @Description:
 * @author: jiangta
 * @date: 2023/8/23 7:52 下午
 * @Version: 1.0
 */
@RestController
@RequestMapping("/example")
@Slf4j
public class ExampleController {

    private String creator = "gaox";
    private ExampleService exampleService;

    @Autowired
    public void setExampleService(ExampleService exampleService) {
        this.exampleService = exampleService;
        log.info("----ExampleController内的exampleService属性被注入");
    }

    public void setCreator(String creator) {
        this.creator = creator;
        log.info("----ExampleController内的creator属性被注入");
    }

    public String getCreator() {
        return creator;
    }

    public ExampleController() {
        log.info("----ExampleController无参构造方法被执行");
    }

    @PostConstruct
    public void myPostConstruct() {
        log.info("----ExampleController类的myPostConstruct方法被调用");
    }
}